package com.dxtx.activity;

import java.util.ArrayList;
import java.util.List;

import android.app.Activity;
import android.os.Bundle;
import android.widget.FrameLayout;

import com.dxtx.widget.DragAdapter;
import com.dxtx.widget.DragSortGridView;
import com.dxtx.widget.R;


public class ChangeAnimFrameActivity extends Activity {

	private DragSortGridView dragSortGridView;
	private DragAdapter dragAdapter;
	private List<String> list;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_test);

		initData();
		intView();
	}

	private void initData() {
		list = new ArrayList<String>();
		for (int i = 0; i < 50; i++) {
			list.add("" + i);
		}
	}

	private void intView() {
		dragSortGridView = (DragSortGridView) findViewById(R.id.dragSort1);
		// 长按item响应该item的拖动排序,默认是触摸就开始拖动
		dragSortGridView.setDragModel(DragSortGridView.DRAG_BY_LONG_CLICK);
		dragAdapter = new MyAdapter(this, list);
		dragSortGridView.setAdapter(dragAdapter);

		FrameLayout animFrame = (FrameLayout) findViewById(R.id.animFrame);
		dragSortGridView.setAnimFrame(animFrame);
	}

}
